function angle_changed = angle_tuning(way_points,map,theta)

angle_changed = way_points(1,:);
k=1;
for n = 2:length(way_points)-1
    first_node  = way_points(n-1,:);
    second_node = way_points(n,:);
    third_node  = way_points(n+1,:);  
    
    v1 = second_node - first_node;
    v2 = third_node - second_node;
    
    alpha = acos(dot(v1,v2)/(norm(v1)*norm(v2)));
    if(alpha>theta)
%         if(alpha>0)
%             delta_angle = theta - alpha;
%         else
%             delta_angle = theta + alpha;
%         end
%         alpha
%         first_node
%         second_node
%         third_node
        k=k+1;
        temp_node = (first_node + third_node)/2;
        new_seconde = second_node + (temp_node - second_node)/2;
        
        count = 0;
        [~,feasible1]=collisionChecking(first_node,new_seconde,map);
        if feasible1
            [~,feasible2]=collisionChecking(new_seconde,third_node,map);
        end
        while(~feasible1||~feasible2)
            new_seconde = second_node + (new_seconde - second_node)/2;
            [~,feasible1]=collisionChecking(first_node,new_seconde,map);
            if feasible1
                [~,feasible2]=collisionChecking(new_seconde,third_node,map);
            end
%             count = count + 1;
%             if count>10
%                 break;
%             end
        end
%         if count>10
%             
%         end
        angle_changed(k,:) = new_seconde;
        continue;
    end
    k=k+1;
    angle_changed(k,:) = second_node;
end
